//
// Created by fengjl on 2017/4/28.
//
#include <jni.h>
#include <string>
#include "preinclude/nativecalc.h"

extern "C"
JNIEXPORT jfloat JNICALL
Java_com_example_fengjl_ndkdemo_calc_Calc_calcNative(JNIEnv *env, jclass type, jint calcType,
                                                     jint param1, jint param2) {

    // TODO
    // TODO
    jfloat  result = 0;

    switch (calcType){

        case 0:
            result = native_calc_add(param1,param2);
            break;
        case 1:
            result  = native_calc_sub(param1,param2);
            break;
        case 2:
            result = native_calc_mult(param1,param2);
            break;
        case 3:
            result = native_calc_divid(param1,param2);
            break;
        default:
            result = 0;
            break;
    }
    return result;
}
